package com.p2p.auth.domain.entity;

import com.p2p.auth.common.enums.AuthMenuType;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 *
 * @author Antinomy
 * @date 17/7/25
 */
@Entity
@Table(name = "t_auth_menu_item")
@DynamicInsert
@DynamicUpdate
@EntityListeners(AuditingEntityListener.class)
@Data
public class AuthMenuItem extends IdEntity {

    private static final long serialVersionUID = 57905418004627785L;
    @Column(columnDefinition = "varchar(100) NOT NULL comment '唯一ID'")
    private String uniqueId;

    @Column(columnDefinition = "varchar(100) NOT NULL UNIQUE comment '菜单ID'")
    private String menuId;

    @Column(columnDefinition = "varchar(50) comment '名称'")
    private String label;

    @Column(columnDefinition = "varchar(50) comment '路由地址'")
    private String router;

    @Column(columnDefinition = "varchar(40) NOT NULL comment '菜单类型' ")
    @Enumerated(EnumType.STRING)
    private AuthMenuType menuType;

    @Column(columnDefinition = "varchar(50) comment '父菜单Id'")
    private String parentId;

    @Column(columnDefinition = "varchar(50) comment '图标'")
    private String icon;
}
